/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmMain.java
 *
 * Created on 28-lug-2011, 11.39.39
 */
package UI;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

/**
 *
 * @author mrossetti
 */
public class frmMain extends javax.swing.JFrame {

    /** Creates new form frmMain */
    private frmClienti Clienti;
    private frmCompopnente Componente;
    private frmArticoli Articolo;
    private frmCommesse Commessa;
    private dlgAbout About;
    public frmMain() {
        initComponents();
        BufferedImage img = null;
        try{
            img = ImageIO.read(this.getClass().getResourceAsStream("/resources/main/package.png"));
        }catch(Exception e){
            e.printStackTrace();
        }
        setIconImage(img);
        setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - getSize().width)/2, (Toolkit.getDefaultToolkit().getScreenSize().height - getSize().height)/2);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        P = new javax.swing.JPanel();
        mnuMain = new javax.swing.JMenuBar();
        mnuLavorazioni = new javax.swing.JMenu();
        mnuCommesse = new javax.swing.JMenuItem();
        mnuAnagrafiche = new javax.swing.JMenu();
        mnuClienti = new javax.swing.JMenuItem();
        Sep1 = new javax.swing.JPopupMenu.Separator();
        mnuArticoli = new javax.swing.JMenuItem();
        mnuComponenti = new javax.swing.JMenuItem();
        mnuAbout = new javax.swing.JMenu();
        mnuInfoAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("The Warehouse");
        setBounds(new java.awt.Rectangle(200, 200, 800, 600));
        setIconImages(null);

        javax.swing.GroupLayout PLayout = new javax.swing.GroupLayout(P);
        P.setLayout(PLayout);
        PLayout.setHorizontalGroup(
            PLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 613, Short.MAX_VALUE)
        );
        PLayout.setVerticalGroup(
            PLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 437, Short.MAX_VALUE)
        );

        getContentPane().add(P, java.awt.BorderLayout.CENTER);

        mnuLavorazioni.setText("Lavorazioni");

        mnuCommesse.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/commesse/kfm.png"))); // NOI18N
        mnuCommesse.setText("Commesse");
        mnuCommesse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuCommesseActionPerformed(evt);
            }
        });
        mnuLavorazioni.add(mnuCommesse);

        mnuMain.add(mnuLavorazioni);

        mnuAnagrafiche.setText("Anagrafiche");

        mnuClienti.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/clienti/identity.png"))); // NOI18N
        mnuClienti.setText("Clienti");
        mnuClienti.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuClientiActionPerformed(evt);
            }
        });
        mnuAnagrafiche.add(mnuClienti);
        mnuAnagrafiche.add(Sep1);

        mnuArticoli.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/articoli/gear.png"))); // NOI18N
        mnuArticoli.setText("Articoli");
        mnuArticoli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuArticoliActionPerformed(evt);
            }
        });
        mnuAnagrafiche.add(mnuArticoli);

        mnuComponenti.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/componenti/exec.png"))); // NOI18N
        mnuComponenti.setText("Componenti");
        mnuComponenti.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuComponentiActionPerformed(evt);
            }
        });
        mnuAnagrafiche.add(mnuComponenti);

        mnuMain.add(mnuAnagrafiche);

        mnuAbout.setText("Info");

        mnuInfoAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/main/info.png"))); // NOI18N
        mnuInfoAbout.setText("Informazioni sul programma");
        mnuInfoAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuInfoAboutActionPerformed(evt);
            }
        });
        mnuAbout.add(mnuInfoAbout);

        mnuMain.add(mnuAbout);

        setJMenuBar(mnuMain);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuClientiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuClientiActionPerformed
        Clienti = new frmClienti();
        Clienti.setVisible(true);
    }//GEN-LAST:event_mnuClientiActionPerformed

    private void mnuComponentiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuComponentiActionPerformed
        Componente = new frmCompopnente();
        Componente.setVisible(true);
    }//GEN-LAST:event_mnuComponentiActionPerformed

    private void mnuArticoliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuArticoliActionPerformed
        Articolo = new frmArticoli();
        Articolo.setVisible(true);
    }//GEN-LAST:event_mnuArticoliActionPerformed

private void mnuCommesseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCommesseActionPerformed
    Commessa = new frmCommesse();
    Commessa.setVisible(true);
}//GEN-LAST:event_mnuCommesseActionPerformed

private void mnuInfoAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuInfoAboutActionPerformed
    About = new dlgAbout(this, true);
    About.setVisible(true);
}//GEN-LAST:event_mnuInfoAboutActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new frmMain().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel P;
    private javax.swing.JPopupMenu.Separator Sep1;
    private javax.swing.JMenu mnuAbout;
    private javax.swing.JMenu mnuAnagrafiche;
    private javax.swing.JMenuItem mnuArticoli;
    private javax.swing.JMenuItem mnuClienti;
    private javax.swing.JMenuItem mnuCommesse;
    private javax.swing.JMenuItem mnuComponenti;
    private javax.swing.JMenuItem mnuInfoAbout;
    private javax.swing.JMenu mnuLavorazioni;
    private javax.swing.JMenuBar mnuMain;
    // End of variables declaration//GEN-END:variables
}
